package bavaria.hightech.banking.bank;


import junit.framework.TestCase;

import org.junit.Before;

import bavaria.hightech.banking.bank.Currency;
import bavaria.hightech.banking.bank.Money;

public class MoneyTest extends TestCase {

	private Money money1;
	private Money money2;

	private int stupidNr1;
	private int stupidNr2;

	@Before
	public void setUp() throws Exception {
		money1 = new Money(20, Currency.EURO);
		money2 = new Money(30, Currency.EURO);

		stupidNr1 = 2;
		stupidNr2 = 3;
	}
	
	public void testAdd() {
		assertTrue(money1.add(money2).same(new Money(50, Currency.EURO)));
	}
	
	public void testSame(){ //da ich oben (bei testAdd) same() verwendet hab
		assertEquals(money1.add(money2).toString(), "Money [money=50, currency=EURO]");
	}

	public void testSubtract() {
		assertTrue(money1.subtract(money2).same(new Money(-10, Currency.EURO)));
	}
	
	public void testCalculateInterest(){
		assertTrue(money1.calculateInterest(2).same(new Money(40, Currency.EURO)));
	}
	
	public void testNegate(){
		assertTrue(money1.negate().same(new Money(-20, Currency.EURO)));
	}
	
	public void testGreaterThan(){
		assertEquals(money1.greaterThan(money2), false);
	}
	
	public void testGreaterThanEquals(){
		assertEquals(money1.greaterThanEquals(money1), true);
	}
	
	public void testForStupidMe() {
		assertTrue(stupidNr1 + stupidNr2 == 5);
	}
}

